*===============================================================================
* Title: Two Levels - Communication
* Date: Nov 23
* Author: Agatha, Alex
*===============================================================================


*** TV-debates
* reception
gen B_tvduell=kp6_1800 if !missing(kp6_1800)

gen L_tvduell=kp9_1800 if !missing(kp9_1800)
lab val B_tvduell L_tvduell kp6_1800

fre B_tvduell L_tvduell
tab B_tvduell L_tvduell, row

lab var B_tvduell "Rezeption TV-Duell (BTW)"
lab var L_tvduell "Rezeption TV-Duell (LTW)"

* winner/looser
gen B_tvduellspd = (kp6_1820-5)/-4 if !missing(kp6_1820)
replace B_tvduellspd = (kp7_1820-5)/-4 if !missing(kp7_1820) & B_tvduellspd==.
gen B_tvduellcdu = (kp6_1810-5)/-4 if !missing(kp6_1810)
replace B_tvduellcdu = (kp7_1810-5)/-4 if !missing(kp7_1810) & B_tvduellcdu==.

gen L_tvduellspd = (kp9_1820-5)/-4 if !missing(kp9_1820)
gen L_tvduellcdu = (kp9_1810-5)/-4 if !missing(kp9_1810)

lab var L_tvduellspd "TV-Duell Performanz: SPD-Kandidat (LTW)"
lab var L_tvduellcdu "TV-Duell Performanz: CDU-Kandidat (LTW)"
lab var B_tvduellspd "TV-Duell Performanz: SPD-Kandidat (BTW)"
lab var B_tvduellcdu "TV-Duell Performanz: CDU-Kandidat (BTW)"


*** party contacts
* 1 = named for at least one party
foreach x in B_ {
	egen `x'plakate = rowmin(kp8_421g*) 
	egen `x'flyer 	= rowmin(kp8_421i*) 
	egen `x'veranst	= rowmin(kp8_421a*) 
	egen `x'werbf	= rowmin(kp8_421d*) 
	egen `x'werbr	= rowmin(kp8_421e*) 
	egen `x'stand	= rowmin(kp8_421h*) 
	egen `x'sozmed	= rowmin(kp8_421b*) 
}

foreach x in L_ {
	egen `x'plakate = rowmin(kp9_421g*) 
	egen `x'flyer 	= rowmin(kp9_421i*) 
	egen `x'veranst	= rowmin(kp9_421a*) 
	egen `x'werbf	= rowmin(kp9_421d*) 
	egen `x'werbr	= rowmin(kp9_421e*) 
	egen `x'stand	= rowmin(kp9_421h*) 
	egen `x'sozmed	= rowmin(kp9_421b*) 
}

foreach x in L_ B_ {
lab var  `x'plakate		"Plakate gesehen"
lab var  `x'flyer 		"Flugblatt, Email, SMS"
lab var  `x'veranst		"Wahlveranstaltung"
lab var  `x'werbf	 	"Wahlwerbung Fernsehen"
lab var  `x'werbr	 	"Wahlwerbung Radio"
lab var  `x'stand	 	"Gespraech Wahlkampfstand"
lab var  `x'sozmed	 	"Soziale Netzwerke"
}
